# semanage AttributeError

## iamthememory

I was working on a new server, and immediately after going through the amd64 Gentoo Handbook (using hardened-sources), I began to follow through the Gentoo SeLinux Handbook. All went well until I reached the part at which it describes how to create a SeLinux user for a Linux user. So, I did the following:

```
semanage login -a -s staff_u memory

restorecon -R -F /home/memory

semanage user -a -R "staff_r sysadm_r" memory

```

After this, I began to have an error with semanage:

```
asmodeus ~ # semanage user -l

Traceback (most recent call last:(

  File "/usr/sbin/semanage-2.7", line 554, in <module>

    process_args(sys.argv[1:])

  File "/usr/sbin/semanage-2.7", line 375, in process_args

    OBJECT.list(heading, locallist)

  File "/usr/lib64/python2.7/site-packages/seobject.py", line 830, in list

    ddict = self.get_all(locallist)

  File "/usr/lib64/python2.7/site-packages/seobject.py", line 815, in get_all

    roles = rlist.join(' ');

AttributeError: 'list' object has no attribute 'join'

asmodeus ~ #

```

I believed it worked fine before. emerge --info :

```
Portage 2.1.11.9 (hardened/linux/amd64/selinux, gcc-4.5.3, glibc-2.15-r2, 3.4.5-hardened-asmodeus x86_64)

=================================================================

System uname: Linux-3.4.5-hardened-asmodeus-x86_64-Intel-R-_Pentium-R-_D_CPU_2.80GHz-with-gentoo-2.1

Timestamp of tree: Tue, 14 Aug 2012 16:45:01 +0000

app-shells/bash:          4.2_p20

dev-lang/python:          2.7.3-r2, 3.2.3

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.1

sys-devel/binutils:       2.22-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)

sys-libs/glibc:           2.15-r2

Repositories: gentoo

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=nocona -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=nocona -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://mirror.mcs.anl.gov/pub/gentoo/ rsync://mirror.mcs.anl.gov/gentoo/ ftp://mirror.mcs.anl.gov/pub/gentoo/ http://mirror.datapipe.net/gentoo ftp://mirror.datapipe.net/gentoo http://gentoo.mirrors.easynews.com/linux/gentoo/ http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ http://www.gtlib.gatech.edu/pub/gentoo rsync://rsync.gtlib.gatech.edu/gentoo ftp://ftp.gtlib.gatech.edu/pub/gentoo http://gentoo.mirrors.hoobly.com/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://lug.mtu.edu/gentoo/ ftp://lug.mtu.edu/gentoo/ ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/ http://gentoo.netnitco.net http://gentoo.osuosl.org/ http://gentoo.mirrors.pair.com/ ftp://gentoo.mirrors.pair.com/ rsync://mirrors.rit.edu/gentoo/ ftp://mirrors.rit.edu/gentoo/ http://mirrors.rit.edu/gentoo/ ftp://mirror.iawnet.sandia.gov/pub/gentoo/ http://mirror.iawnet.sandia.gov/gentoo/ ftp://gentoo.llarian.net/pub/gentoo http://gentoo.llarian.net/ ftp://gentoo.mirrors.tds.net/gentoo rsync://gentoo.mirrors.tds.net/gentoo http://gentoo.mirrors.tds.net/gentoo http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.lug.udel.edu/pub/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/ http://gentoo.cites.uiuc.edu/pub/gentoo/ ftp://gentoo.cites.uiuc.edu/pub/gentoo/ rsync://gentoo.cs.uni.edu/gentoo-distfiles http://gentoo.cs.uni.edu/ http://mirror.usu.edu/mirrors/gentoo/ ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en en_US ja"

MAKEOPTS="-j1"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"

USE="amd64 berkdb bzip2 cli cracklib crypt cups cxx doc dri examples gdbm gpm hardened iconv ipv6 justify mmx modules mudflap multilib ncurses nls nptl open_perms openmp pam pax_kernel pcre peer_perms pppd python readline selinux session sse sse2 ssl tcpd ubac unicode urandom zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US ja" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

sestatus -v :

```
SELinux status:                 enabled

SELinuxfs mount:                /sys/fs/selinux

SELinux root directory:         /etc/selinux

Loaded policy name:             strict

Current mode:                   permissive

Mode from config file:          permissive

Policy MLS status:              disabled

Policy deny_unknown status:     denied

Max kernel policy version:      26

Process contexts:

Current context:                staff_u:sysadm_r:sysadm_t

Init context:                   system_u:system_r:init_t

/sbin/agetty                    system_u:system_r:getty_t

/usr/sbin/sshd                  system_u:system_r:sshd_t

File contexts:

Controlling terminal:           staff_u:object_r:user_devpts_t

/sbin/init                      system_u:object_r:init_exec_t

/sbin/agetty                    system_u:object_r:getty_exec_t

/bin/login                      system_u:object_r:login_exec_t

/sbin/rc                        system_u:object_r:rc_exec_t

/usr/sbin/sshd                  system_u:object_r:sshd_exec_t

/sbin/unix_chkpwd               system_u:object_r:chkpwd_exec_t

/etc/passwd                     system_u:object_r:etc_t

/etc/shadow                     system_u:object_r:shadow_t

/bin/sh                         system_u:object_r:bin_t -> system_u:object_r:shell_exec_t

/bin/bash                       system_u:object_r:shell_exec_t

/usr/bin/newrole                system_u:object_r:newrole_exec_t

/lib/libc.so.6                  system_u:object_r:lib_t -> system_u:object_r:lib_t

/lib/ld-linux.so.2              system_u:object_r:lib_t -> system_u:object_r:ld_so_t

```

Any help in fixing this would be appreciated. Thank you.

----------

## iamthememory

I've decided to try starting again from creating the base system to see if it's just some error I made while setting it up.

----------

